<div class="modal-header">
	<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-remove"></li></button>
	<h5 class="modal-title">编辑家庭成员</h5>
</div>

<div class="modal-body">

	<form id="edit-family" name="edit-family" class="form-horizontal" >
		<div class="box-body">
			<input type="hidden" name="id" />
			<div class="col-md-6">
				<div class="form-group">
					<label for="appName" class="col-sm-3 control-label">家庭关系</label>
					<div class="col-sm-8">
						<select  name="relationShip"   type="text"
													class="form-control select2" placeholder="家庭关系" style="width:200px;">
						    <option value="39">Aunt                         </option>
							<option value="35">Brother                      </option>
							<option value="1">Child                         </option>
							<option value="31">Cousin                       </option>
							<option value="63">Daughter/Son-in-law          </option>
							<option value="13">Fiance/Fiancee               </option>
							<option value="33">Friend                       </option>
							<option value="19">Grand Child                  </option>
							<option value="18">Grand Parent                 </option>
							<option value="62">Mother/Father-in-law         </option>
							<option value="42">Nephew                       </option>
							<option value="41">Niece                        </option>
							<option value="2">Parent                        </option>
							<option value="36">Sister                       </option>
							<option value="64">Sister/Brother-in-law        </option>
							<option value="3">Spouse/De Facto Partner       </option>
							<option value="15">Step Child                   </option>
							<option value="14">Step Parent                  </option>
							<option value="37">Step-brother                 </option>
							<option value="38">Step-sister                  </option>
							<option value="40">Uncle                        </option>
						</select>
					</div>
				</div>
				<div class="form-group">
					<label for="servicesName" class="col-sm-3 control-label">姓氏</label>
					<div class="col-sm-8">
						<input type="text" class="form-control"  name="familyName" placeholder="姓氏" th:value="${fm.familyName}" required >
					</div>
				</div>
				<div class="form-group">
					<label for="minutes" class="col-sm-3 control-label">名称</label>

					<div class="col-sm-8">
						<input type="text" class="form-control" required  name="givenName" placeholder="名称" th:value="${fm.givenName}">
					</div>
				</div>
				
			</div>
			<div class="col-md-6">
				
				<div class="form-group">
					<label for="userName" class="col-sm-3 control-label">出生日期</label>

					<div class="col-sm-8 input-group">
						<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
						<input type="text" class="form-control" data-flag="datepicker" data-format="yyyy-MM-dd" name="birthdate" 
							placeholder="出生日期">
					</div>
				</div>
				<div class="form-group">
					<label for="mobiles" class="col-sm-3 control-label">性别</label>

					<div class="col-sm-8">
						<label class="control-label"> <input type="radio"
							name="sex" data-flag="icheck" class="flat-red" value="M" checked="checked">
							男
						</label> &nbsp; <label class="control-label"> <input
							type="radio" name="sex" data-flag="icheck" class="flat-red"
							value="F"> 女
						</label>
					</div>
				</div>
				<div class="form-group">
					<label for="email" class="col-sm-3 control-label">是否同去</label>

					<div class="col-sm-8">
						<label class="control-label"> <input type="radio"
							name="togeth" data-flag="icheck" class="flat-red" value="1" checked="checked" data-c-valid="false">
							是
						</label> &nbsp; <label class="control-label"> <input
							type="radio" name="togeth" data-flag="icheck" class="flat-red" data-c-valid="false"
							value="0"> 否
						</label>
					</div>
				</div>
				
			</div>
		</div>
		<!-- /.box-body -->
		<div class="box-footer text-right">
			<button type="button" class="btn btn-default" data-btn-type="cancel" data-dismiss="modal">取消</button>
			<button type="submit" class="btn btn-primary" data-btn-type="save">提交</button>
		</div>
		<!-- /.box-footer -->
	</form>

</div>
<script>
$(function() {
	//初始化控件
	var form=$("#edit-family").form({baseEntity:false});
	$("#edit-family").bootstrapValidator({
		message : '请输入有效值',
		excluded: [':disabled', ':hidden', ':not(:visible)',function($field, validator) {
		    return ($field.attr('data-c-valid')=='false');
		}],
		feedbackIcons : {
			valid : 'glyphicon glyphicon-ok',
			invalid : 'glyphicon glyphicon-remove',
			validating : 'glyphicon glyphicon-refresh'
		},fields : {
			'birthdate' : {
				validators : {
					notEmpty : {
						message : '请输入出生日期'
					},
					date : {
						format : $(this).data("format"),
						message : '请输入有效日期'
					} 
				}
			},familyName : {
				validators : {
					notEmpty : {
					}
				}
			},givenName : {
				validators : {
					notEmpty : {
					}
				}
			},sex : {
				validators : {
					notEmpty : {
					}
				}
			},togeth : {
				validators : {
					notEmpty : {
					}
				}
			}
		},
		submitHandler : function(validator, userform, submitButton) {
			var params = form.getFormSimpleData();
			addFamilyMember(params);
			modals.hideWin(winId); 
			
		}
	});
	form.initComponent();
	console.log(editRows);
	if(editRows){
		form.initFormData(editRows);
		$('#edit-family input[name="birthDate"]').val(editRows.birthDate);
	}
	
	
});
</script>
